This is a set of three MPW tools that I wrote for hardware debug and bring-up. You could probably write them yourself in an hour or so – but what if you don’t have that much time...
RW - read or write a long
Usage:
RW address Reads a long from the specified address.
RW address [value] Writes the value as a long to the specified address.
RW8 - read or write a byte
Usage:
RW8 address Reads a byte from the specified address.
RW8 address [value] Writes the value as a byte to the specified address.
baseAddress specifies the beginning address to test.
size specifies the number of bytes to test (as longs though).
initialPattern specifies a seed pattern. This is the initial value of the incrementing pattern.
increment is the value added to the incrementing pattern following each read or write.
The algorithm: The address range specified from baseAddr to baseAddr+size is treated as an array of 4-byte longwords. The array is tested in two passes: the first pass fills the array with a known data pattern and the second pass verifies the pattern.
Starting at the location specified by baseAddr, the array is filled with a pattern with a starting value of initialPattern and increments by increment for each successive location. For example, if initialPattern is 1234 and increment is 1122, then the fill pattern will be:
location pattern
baseAddr 1234
baseAddr+4 2356
baseAddr+8 3478
baseAddr+12 4600
etc...
Once the array is filled with the incrementing pattern, the second pass reads and verifies the contents of the array. This, again, starts at the location specified by baseAddr. The test terminates on the first location that does not contain the value that was written to it.
I often use the incrementing pattern algorithm to implement a more specialized algorithm that I call an address pattern. If the value of initialPattern is the same as that of baseAddr and the value of increment is 4, the following pattern is generated:
location pattern
baseAddr baseAddr
baseAddr+4 baseAddr
baseAddr+8 baseAddr
baseAddr+12 baseAddr
etc...
The nice thing about the address pattern algorithm is that stuck data bits and address aliases are easy to “see” by visually inspecting the contents of the address range following a failure. For example:
location pattern
$10000000 $10020000
$10000004 $10020004
$10000008 $10020008
$1000000c $1002000c
...
$10001230 $10021230
$10001234 $10021234
$10001238 $10021238
$1000123c $1002123c
...
$10020000 $10020000
$10020004 $10020004
$10020008 $10020008
$1002000c $1002000c
etc...
This is likely data bit-17 stuck high or address bit-17 stuck either high or low.
Examples
Set baseAddr 0xfe000000
RW8 {baseAddr} # Reads a byte at {baseAddr}.
RW {baseAddr} 0xffffffff # Writes $ffffffff to {baseAddr}.
RW {baseAddr} 123 # Writes 123 to {baseAddr}.
RW {baseAddr} 0b100100011 # Writes 123 to {baseAddr}.
# Scope loop.
Loop
RW {baseAddr}
End
Set ramBase 0xfe080000
Set ramSize `Evaluate (512 * 1024)`
# Address pattern test.
IncrPattern {ramBase} {ramSize} {ramBase} 4
Now what...
Of course there’s a lot more these tools could do – either by scripting or by modifying the tools themselves. You’ve got the source, help yourself. I’d really appreciate it if you’d send any really useful additions back my way.